home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 10
/
FM Towns Free Software Collection 10.iso
/
ms_dos
/
tool
/
conhlp03
/
padp_src
/
ppgmenu.c
< prev
Wrap
C/C++ Source or Header
|
1995-02-20
|
3KB
|
130 lines
/*
ppgmenu.c
tab=8
1994/11/23 1994/11/27 1995/02/20
*/
#define PPGMENU
#include "padpage.h"
byte slmenu( const char *s[], int *k ){
int i,sl;
byte r ;
cprintf("\x1b[2;25H\x1b[33m%s\x1b[0K",s[0]);
sl = 1;
do{
for( i = 1 ; *s[i] != NULL ; i++ ){
cprintf("\x1b[2;%dH\x1b[32;%dm%-8s\x1b[m",
48 + ( i - 1 ) * 8,
( sl == i ) ? 7 : 2 ,
s[i] );
}
while( inkey() != NULL );
while( ( r = inkey() ) == NULL );
sl = ( r == LEFT ) ? sl - 1 : ( r == RIGHT ) ? sl + 1 : sl ;
sl = ( sl + i ) % i ;
} while( r == LEFT || r == RIGHT );
*k = sl;
return r;
}
#define SLMES 7
byte ppgmenu( uint *cline ){
static const char *slmes[SLMES][5] = {
"すくろ~る しま~す"," あがる "," さがる ","","" ,
"ここに しるし つける","","","","" ,
">-> だいぶ >-> "," しるし "," しっぽ "," あたま ","" ,
"こまんど を よぶ","","","","" ,
"さいなら~♪","","","","" ,
/*
"たぶ は どっちだ"," - 4 - "," - 8 - ","","" ,
*/
"たぶ は 変更不可"," - 4 - "," - 8 - ","","" ,
"ぎょうかん は どう?"," あける "," つめる ","",""
};
int i,k;
byte r;
cputs("\x1b[2;5H\x1b[36;7m<< めにゅ~ >>->>-\x1b[m");
r = ON;
for( i = 0 ; r != NULL ; i = ( i + SLMES ) % SLMES ){
switch ( r = slmenu( slmes[i], &k ) ) {
case QUIT: /* B */
k = -1;
case EXEC: /* A */
r = NULL; /* メニューを抜ける */
break;
case UP: i--;
break;
case DOWN:
i++;
break;
default:
break;
}
}
r = OFF;
cputs( ESCSQU"2;1H" ESC_reset );
if( k < 0 ) i = SLMES;
switch ( i ) {
case 0: /* scroll */
cputs( ESCSQU"2;1H" ESC_el0 );
*cline = ppgscroll( ( k == 1 ) ? '+' :
( k == 2 ) ? '-' : NULL ,
*cline ) ;
break;
case 1: /* mark */
mline = *cline ;
break;
case 2: /* jump */
*cline = ( k == 1 ) ? mline :
( k == 2 ) ? MAXLINE :
( k == 3 ) ? 1 : *cline ;
break;
case 3: /* call command */
cur( ON );
width( 25 );
system("");
cur( OFF );
width( 20 );
break;
case 4: /* quit */
r = ON; /* padpage quit */
break;
case 5: /* tab */
break;
tabs = ( k == 1 ) ? 4 : ( k == 2 ) ? 8 : tabs ;
if( tabs == 8 && k == 1 ){
tabs = 4;
}else
if( tabs == 4 && k == 2 ){
tabs = 8;
}else{
break;
}
dsppage( 1, setline( -1 ) ); /* 再初期化 */
dsppage( *cline, setline( *cline ) );
break;
case 6: /* width mode */
if( k == 2 ){
width( 25 );
maxdisp = 21;
}else if( k == 1 ){
width( 20 );
maxdisp = 16;
}
break;
default:
break;
}
return r;
}